package com.jsb.laundry.dao.factory;


import com.jsb.laundry.common.utils.sf.FactoryInfoDto;
import com.jsb.laundry.common.utils.sf.UserInfoDto;
import com.jsb.laundry.model.factory.*;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 洗衣工厂模块
 *
 * @data 2023/3/16 13:57
 */
@Repository
public interface LaundryFactoryDao {
    /**
     * 登录
     * @param sysFactory
     * @return
     */
    int login(SysFactory sysFactory);
    String factoryLogin(SysFactory sysFactory);
    HashMap shopsInfo(String phone);

    /**
     * 工厂账单列表2.0
     * @param info
     * @return
     */
    List<FactoryOrderInfo> orderInfoList(FactoryOrderInfo info);

    /**
     * 入库出库数据列表
     * @return
     */
    List<OrderInfoDtos> inAndOutDataList(OrderInfoDtos orderInfoDtos);

    /**
     * 入库、出库大订单状态改变
     * @param orderInfoDtos
     * @return
     */
    int updOrderStatus(OrderInfoDtos orderInfoDtos);
    List<OrderInfoDtos> findruku(OrderInfoDtos orderInfoDtos);

    List<GoodsInfo> goodsList();
    List<FactoryOrderInfo>findByOrderInfo(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("goodsId") String goodsId,@Param("keywords") String keywords);
    List<FactoryOrderInfo>findByOrderInfos(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("goodsId") String goodsId,@Param("keywords") String keywords,@Param("payId") String payId);

    List<Site> site();


    List<OrderinfoList> payIdList(String payId);
    int sss(OrderInfoDtos orderInfoDtos);
    int ssss(@Param("orderStatus") String orderStatus, @Param("payIds") List<String> payIds);
    int updInspect(@Param("orderId") String orderId, @Param("checked") String inspect,@Param("flag") String flag);
    List<FindByList> findByList(FindByList findByList);
    int updOrderDetails(FindByList findByList);
    OrderInfoShops orderInfoShops1(@Param("subOrderId") String subOrderId);
//    List<OrderInfoShops> orderInfoShops2(String payId);
    List<OrderInfoShops> orderInfoShops3(@Param("orderId")String orderId,@Param("subOrderId")String subOrderId);
    int updImg(@Param("orderId") String orderId,@Param("postDevelopmentPhotos") String postDevelopmentPhotos);
    int updGoodsId(@Param("goodsId") String goodsId,@Param("serveId") String serveId,@Param("orderId") String orderId);

    /**
     * 工厂出库入库检查 订单中添加检查图片
     * @param orderId
     * @param picListStr
     * @param flag
     * @return
     */
    int checkClothesEnterOrOut(@Param("orderId") String orderId,@Param("picListStr") String picListStr,@Param("flag") String flag);


    /**
     * 获取工厂id
     * @return
     */
    List<ShopsLngLatDto> findFactory();

    /**
     * 获取洗衣用户填写的上门取衣地址,用于顺丰下单
     * @param payId
     * @param userId id
     * @return
     */
    List<UserInfoDto> getLaundryUserDetailInfo(@Param("payId") String payId, @Param("userId") String userId);

    /**
     * 获取工厂信息
     *
     * @return
     */
    FactoryInfoDto getLaundryFactoryInfo(@Param("shopsId") String shopsId);
    /**
     * 支付成功后更新订单的信息（支付成功后，订单分配给顺丰时更新状态）
     * order_status,order_direction,pay_time,del_flag
     */
    int updLaundryOrderInfo(@Param("shopsId") String shopsId,@Param("payId") String payId, @Param("sfWaybillNo") String sfWaybillNo, @Param("type")int type,@Param("backOrderId") String back_pay_id);

    /**
     * 订单从工厂返回到用户手中
     * @param userId
     * @param orderId
     * @return
     */
    int updLaundryOrderInfo1(@Param("userId")String userId,@Param("orderId") String orderId,@Param("backOrderId")String backOrderId);


    int opColour0(@Param("name")String name, @Param("c")String c16);

    int opColour1(@Param("uuid")String uuid, @Param("name")String name, @Param("c")String c16);

    int opColour2(String uuid);

    int opACC0(String name);

    int opACC1(@Param("uuid")String uuid, @Param("name")String name);

    int opACC2(String uuid);

    int opBrand0(@Param("name")String name,@Param("pic") String pic);

    int opBrand1(@Param("uuid")String uuid,@Param("name") String name,@Param("pic") String pic);

    int opBrand2(String uuid);

    int opEffect0(String name);

    int opEffect1(@Param("uuid")String uuid, @Param("name")String name);

    int opEffect2(String uuid);

    int opFlaw0(@Param("t")String t,@Param("name") String name,@Param("pid") String pid);

    int opFlaw1(@Param("t")String t,@Param("uuid") String uuid,@Param("pid") String pid,@Param("name") String name);

    int opFlaw2(@Param("t")String t,@Param("uuid") String uuid,@Param("pid") String pid);

    HashMap findUserOrderInfo(@Param("userId")String userId, @Param("payId") String payId);

    List<WxRiderList> findByqOpenId();

    Boolean buyCouponEd(String userId);

    List<String> findOrderIdByPayId(String payId);

    int addOrderFulfillment(JsbOrdersFulfillment ordersFulfillment);

    int addOrderFulfillmentItem(@Param("list") List<JsbOrdersFulfillmentItem> ordersFulfillmentItem);

    List<JsbOrdersItem> finSubOrderInfo(@Param("orderId")String payId,@Param("list") List<String> goodsId);


    List<FactoryOrderInfo> downloadExcelV2(FactoryOrderInfo info);

    JsbOrdersFactory getOrdersFactoryInfo(@Param("orderId") String payId);
    List<JsbOrdersFactory> getOrdersFactoryInfo1(@Param("list") List orderIds);

    /**
     * 父订单信息
     * @param orderId
     * @return
     */
    JsbOrders getOrderInfo(String orderId);
    List<JsbOrders> getOrderInfo1(@Param("list") List noInFactoryOrders);


    /**
     * 获取所有子订单
     * @param orderId
     * @return
     */
    List<JsbOrdersItem> getSubOrderList(String orderId);

    /**
     * 订单保存到工厂
     * @param ordersFactory
     * @return
     */
    Integer addOrderFactory(JsbOrdersFactory ordersFactory);
    Integer addOrderFactory1(@Param("list") List<JsbOrdersFactory> ordersFactory);

    /**
     * 订单保存到工厂item
     * @param jsbOrdersFactoryItem
     * @return
     */
    int addOrderFactoryItem(@Param("list") List<JsbOrdersFactoryItem> jsbOrdersFactoryItem);

    int addOrderStatusLog(@Param("orderId") String orderId,@Param("code") String code,@Param("msg") String msg,@Param("orderDirection") String orderDirection);

    /**
     * 未检查的数量
     * @param orderId
     * @return
     */
    int getCheckIng(@Param("orderId") String orderId,@Param("flag") String flag);

    /**
     * 全部检查后jsb_orders_factory、jsb_orders有关factory状态变更
     * @param orderId
     * @param flag
     * @return
     */
    int updOrderFactoryStatus(@Param("orderId") String orderId,@Param("flag") String flag);

    int updFactoryOrderStatus(@Param("orderId") String orderId,@Param("flag") String flag);

    /**
     * 获取工厂子表中订单信息
     * @param subOrderIds
     * @return
     */
    List<JsbOrdersFactoryItem> getOrdersFactoryItem(@Param("list") List<JsbOrdersFactoryItem> subOrderIds);

    /**
     *
     * @param subOrderIds
     * @return
     */
    List<JsbOrdersItem> getSubOrderItemList(@Param("list") List subOrderIds);

    /**
     * 查询入工厂订单子表的订单
     * @param subOrderId
     * @return
     */
    List<JsbOrdersFactoryItem> getOrdersFactoryItemByOrderId(@Param("list") List<String> subOrderId);

    /**
     *
     * @param subOrderIdList
     * @return
     */
    List<JsbOrdersItem> getShopSubOrderList(@Param("list") List<String> subOrderIdList);

    /**
     * 已出库订单入司机表jsb_orders_driver_item中
     * @param ordersItemList
     * @return
     */
    int addOrderToDriverItem(@Param("list") List<JsbOrdersItem> ordersItemList);

    List<com.jsb.laundry.model.shops.JsbOrdersFulfillmentItem> getOrdersDriverItem(@Param("list") List<String> subOrderIdList);

    List<JsbOrders> getOrderInfo2(@Param("list") List<String> subOrderIdList);

    HashMap getSubOrderInfoByFulfillmentsId(OrderInfoDtos orderInfoDtos);

    String getFulfillmentsBySubOrderId(String s);


    /**
     * 出库时填充出库时间
     * @param payId
     * @return
     */
//    int updOrderFactory(String payId);
}
